package benchmark;

import java.awt.LayoutManager;

import javax.swing.JFrame;

public abstract class TestFrameImpl implements TestFrame {
	private JFrame frame;

	public JFrame getFrame() {
		return frame;
	}
	private void setFrame(JFrame frame){
		this.frame = frame;
	}

	@Override
	public void create() {
		frame = createFrame();
	}


	@Override
	public void show() {
		getFrame().setVisible(true);
	}	
	
	protected JFrame createFrame(){
		setFrame(new JFrame());
		getFrame().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		getFrame().setLayout(getLayout());
		addComponents();
		
		setAdditionalStuff();
		return frame;
	}

	protected abstract void addComponents();
	/**
	 * To set size, color, location, etc.
	 */
	protected void setAdditionalStuff() {
		// nothing here
	}

	protected abstract LayoutManager getLayout();	
}
